/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package de.hsmannheim.pepa.patientenportal.apanwep.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import de.hsmannheim.pepa.patientenportal.apanwep.model.chronik;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

/**
 * The cache model class for representing chronik in entity cache.
 *
 * @author Cedric Nana
 * @see chronik
 * @generated
 */
public class chronikCacheModel implements CacheModel<chronik>, Externalizable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(21);

		sb.append("{chronik_id=");
		sb.append(chronik_id);
		sb.append(", datetime=");
		sb.append(datetime);
		sb.append(", message=");
		sb.append(message);
		sb.append(", object=");
		sb.append(object);
		sb.append(", participant=");
		sb.append(participant);
		sb.append(", user_id=");
		sb.append(user_id);
		sb.append(", event_date_time_at=");
		sb.append(event_date_time_at);
		sb.append(", event_date_time_down=");
		sb.append(event_date_time_down);
		sb.append(", event_action=");
		sb.append(event_action);
		sb.append(", enable=");
		sb.append(enable);
		sb.append("}");

		return sb.toString();
	}

	@Override
	public chronik toEntityModel() {
		chronikImpl chronikImpl = new chronikImpl();

		chronikImpl.setChronik_id(chronik_id);

		if (datetime == null) {
			chronikImpl.setDatetime(StringPool.BLANK);
		}
		else {
			chronikImpl.setDatetime(datetime);
		}

		if (message == null) {
			chronikImpl.setMessage(StringPool.BLANK);
		}
		else {
			chronikImpl.setMessage(message);
		}

		if (object == null) {
			chronikImpl.setObject(StringPool.BLANK);
		}
		else {
			chronikImpl.setObject(object);
		}

		if (participant == null) {
			chronikImpl.setParticipant(StringPool.BLANK);
		}
		else {
			chronikImpl.setParticipant(participant);
		}

		chronikImpl.setUser_id(user_id);

		if (event_date_time_at == null) {
			chronikImpl.setEvent_date_time_at(StringPool.BLANK);
		}
		else {
			chronikImpl.setEvent_date_time_at(event_date_time_at);
		}

		if (event_date_time_down == null) {
			chronikImpl.setEvent_date_time_down(StringPool.BLANK);
		}
		else {
			chronikImpl.setEvent_date_time_down(event_date_time_down);
		}

		if (event_action == null) {
			chronikImpl.setEvent_action(StringPool.BLANK);
		}
		else {
			chronikImpl.setEvent_action(event_action);
		}

		chronikImpl.setEnable(enable);

		chronikImpl.resetOriginalValues();

		return chronikImpl;
	}

	@Override
	public void readExternal(ObjectInput objectInput) throws IOException {
		chronik_id = objectInput.readLong();
		datetime = objectInput.readUTF();
		message = objectInput.readUTF();
		object = objectInput.readUTF();
		participant = objectInput.readUTF();
		user_id = objectInput.readLong();
		event_date_time_at = objectInput.readUTF();
		event_date_time_down = objectInput.readUTF();
		event_action = objectInput.readUTF();
		enable = objectInput.readLong();
	}

	@Override
	public void writeExternal(ObjectOutput objectOutput)
		throws IOException {
		objectOutput.writeLong(chronik_id);

		if (datetime == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(datetime);
		}

		if (message == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(message);
		}

		if (object == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(object);
		}

		if (participant == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(participant);
		}

		objectOutput.writeLong(user_id);

		if (event_date_time_at == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(event_date_time_at);
		}

		if (event_date_time_down == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(event_date_time_down);
		}

		if (event_action == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(event_action);
		}

		objectOutput.writeLong(enable);
	}

	public long chronik_id;
	public String datetime;
	public String message;
	public String object;
	public String participant;
	public long user_id;
	public String event_date_time_at;
	public String event_date_time_down;
	public String event_action;
	public long enable;
}